<!doctype html>
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>Team Up Shoppers</title>
        <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" />
        <script type="text/javascript" src="{{ url_for('static', filename='dojo/dojo.js.uncompressed.js') }}"
                data-dojo-config="isDebug: true,parseOnLoad: true,async: true">
            //src="http://yandex.st/dojo/1.7.2/dojo/dojo.js"
        </script>
    </head>
    <body>
    {% if 'user_id' in session %}
        <script type="text/javascript" src="{{ url_for('static', filename='app.js') }}" >
        </script>
        <div class="container">
            <h2>Welcome, {{ current_user.name }} | <a href="{{ url_for('logout') }}">log out</a></h2>
            <div id="notices">
                <div id="form">
                    <p>Name:
                    <input type="text" name="name" id="name" /></p>
                    <p>Description:
                    <input type="text" name="descr" id="descr"/></p>
                    <p>Shop:
                    <input type="text" name="shop_name" id="shop_name"/></p>
                    <p>Planned day of order:
                    <input type="text" name="planned_day_of_order" id="planned_day_of_order"/></p>
                    <p><button id="add_notice">Save</button></p>
                </div>
            </div>
            <div style="border: 3px blue solid;" id="output">  
            </div>
            <div id="log">
            </div>
            <div style="border: 3px coral solid;" id="error">
            </div>
        </div>
    {% else %}
        <div class="container">
            <form action="/login" method=post>
                <p>Username:<br />
                <input type="text" name="username" /></p>
                <p>Password:<br />
                <input type="password" name="password" /></p>
                <p><input type=checkbox name=remember value=yes /></p>
                <p><input type="submit" value="login" /></p>
            </form>
            
            <form action="/register" method=post>
                <p>Username:<br />
                <input type="text" name="username" /></p>
                <p>E-mail:<br />
                <input type="text" name="email" /></p>
                <p>Password:<br />
                <input type="password" name="password" />
                <input type=password name=password2 size=30></p>
                <p><input type="submit" value="registrate" /></p>
            </form>
        </div>
    {% endif %}
    {% with messages = get_flashed_messages() %}
        {% for message in messages %}
            {{message}}
        {% endfor %}
    {% endwith %}
    </body>
</html>